package jm.nj.day08jia.demo03;
/*
* 判断公功能
*               boolean equals(Object obj)//判断两个字符串内容是否相等,传入可以是String类型数据
*               boolean equalsIgnoreCase(String str)//比较字符串是否一致,忽略大小写
*               boolean StratsWith(String str) //判断是否str开头
*               boolean endSwith(String str)//判断字符串是否str结尾
*
* */
public class Test01 {
    public static void main(String[] args) {

        String s1 = new String("hello");
        String s2 = "hello";
        String s3 = "Hello";

        System.out.println("s1 = s2:"+(s1 == s2));
        System.out.println("s1 = s3:"+(s1 == s3));
        System.out.println("s1.equals(s2):"+(s1.equals(s2)));
        System.out.println("s1.equals(s3):"+(s1.equals(s3)));

        System.out.println("s1.equalsIgnoreCase:"+(s1.equalsIgnoreCase(s3)));

        System.out.println("==============");

        System.out.println("s2.startsWith(h):"+s2.startsWith("h"));
        System.out.println("s2.startsWith(hel):"+s2.startsWith("h"));
        System.out.println("s2.startsWith(heli):"+s2.startsWith("h"));
        System.out.println();

        System.out.println("=============");

        System.out.println("s2.endsWith(o)"+s2.endsWith("o"));
        System.out.println("s2.endsWith(oo)"+s2.endsWith("oo"));
        System.out.println("s2.endsWith(llo)"+s2.endsWith("llo"));

    }
}
